/*
 * @Author: w
 * @Date: 2022-02-21 15:05:21
 * @Description: 剑指 Offer 03. 数组中重复的数字
 */

// hashMap

/**
 * @param {number[]} nums
 * @return {number}
 */

// Set,集合
var findRepeatNumber = function (nums) {
  const set = new Set(nums);
  for (let i = 0; i < nums.length; i++) {
    if (map.has(nums[i])) {
      return nums[i];
    }
  }
};

// find 结合 indexOf
var findRepeatNumber = function (nums) {
  return nums.find((item, i) => nums.indexOf(item, i + 1) > -1);
};
